package CreateThread;

public class demo3 {
    public static void main(String[] args) throws InterruptedException {
        //用lambda表达式
        Thread thread = new Thread(() -> {
                while(true) {
                    System.out.println("新线程的调度");
                    try {
                        Thread.sleep(1_000);
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                }
        });
        thread.start();
        while (true) {
            System.out.println("主线程的调度");
            Thread.sleep(1_000);
        }
    }
}
